
const {ccclass, property, menu} = cc._decorator;

@ccclass
@menu("按钮/点击移除")
export default class ClickRemove extends cc.Component {

    @property(cc.Boolean)
    isDestory = false;

    @property(cc.Node)
    removeNode: cc.Node = null;

    protected start(): void {
        this.node.once(cc.Node.EventType.TOUCH_END, ()=>{
            let rmNode = this.removeNode || this.node;
            rmNode.removeFromParent();
            this.isDestory && (rmNode.destroy());
        }, this)
    }
}
